﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace FourKill.Engine
{
    public class Mountains : IPaintable
    {
        public Mountains() { GenerateMountains(); }

        Random r = new Random();
        private List<int> _heights = new List<int>();
        int _mountainWidth = 4;
        private void GenerateMountains()
        {
            for (int i = 0; i < 20; i++)
            {
                _heights.Add(r.Next(i, 30));
            }
        }
        public void Paint(IPaintableContext context)
        {
            try
            {
                for (int i = 0; i < _heights.Count; i++)
                {
                    context.FrontLayer.FillRectangle(Brushes.LightBlue, new Rectangle(i * _mountainWidth, context.ViewPort.PixelSize.Height / 2 - 30, _mountainWidth, _heights[i]));
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("***********************************");
                System.Diagnostics.Debug.WriteLine(ex.Message + "\r\n" + ex.StackTrace);
                System.Diagnostics.Debugger.Break();
            }
        }
    }
}
